function getUrlQuery(url, key) {
  let reg = new RegExp(`(^|&)${key}=([^&]*)(&|$)`);
  let surfix = url.indexOf('?') != 0 ? url.replace(/(.*\?)/, '') : '';
  let result = surfix.match(reg);
  return result ? result[2] : null;
}

console.log(getUrlQuery('http://columbus.os.adc.com/requirement/list?projectId=101770&a=1&b=2&c&d=', 'projectId'));